<include file="Public:header" />
<div class="container">
  <div class="page-header">
    <h1>{$coupon.title}优惠券<small></small></h1>
  </div>
  <notempty name="canUse">
    <div class="block_out">
          <div class="block_inner">
              <h6>优惠券信息</h6>
                <p>优惠券名称：{$coupon.title}</p>
                <p>{$coupon.intro}</p>
                <p><img src="{:getThumbPath($coupon['cover'])}"></p>
                <p>
                <if condition="!empty($coupon['start_time']) && !empty($coupon['end_time'])">
                活动时间：{$coupon.start_time|day_format} 至 {$coupon.end_time|day_format}
                </if>
                <if condition="empty($coupon['start_time']) && !empty($coupon['end_time'])">
                截止时间：{$coupon.end_time|day_format}
                </if>                
                </p>
            </div>
        </div>
        <div class="block_out">
          <div class="block_inner">
              <h6>使用说明</h6>
                <p>{$coupon.use_tips}</p>
            </div>
        </div>
        <h6>剩余票数</h6>
        <p>{$exist}</p>
  </notempty>
  <empty name="canUse">
    <h4>该优惠券活动已结束或该优惠券不能使用网页领取</h4>
    <div><img src="{:getThumbPath($coupon['end_img'])}"></div>
  </empty>
  <form action="{:U('receive')}" method="post">
    <input type="hidden" name="member_id" value="{$member_id}">
    <input type="hidden" name="coupon_id" value="{$coupon_id}">

    <button type="submit" class="btn btn-primary">领取</button>
  </form>

  <table class="table">
      <thead>
        <tr>
          <th>我的优惠券</th>
          <th>标题</th>
          <th>领取日期</th>
          <th>过期日期</th>
          <th>状态</th>
        </tr>
      </thead>
      <tbody>
        <volist name="myCoupons" id="sn">
          <if condition="$sn.status eq '1'">
            <tr class="success">
          <else />
            <tr class="danger">
          </if>
            <th scope="row">{$sn.id}</th>
            <td>{$sn.title}</td>
            <td>{$sn.ctime|day_format}</td>
            <td>{$sn.end_time|day_format}</td>
            <td><if condition="$sn.status eq '1'">启用<else />关闭</if></td>
          </tr>
        </volist>
      </tbody>
    </table>
</div>
<include file="Public:footer" /> 